﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using CoiffeurProject.Utils;
using System.Windows.Media;

namespace CoiffeurProject.UserControls
{
    #region SearchBar

    internal class SearchBar
    {
        Grid main_container;
        Image background;
        TextBox text_box;
        Button button;

        internal SearchBar(Thickness margin, int grid_row, int grid_column)
        {
            main_container = new Grid()
            {
                Width = 388,
                Height = 60,
                VerticalAlignment = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = margin
            };

            Grid.SetRow(main_container, grid_row);
            Grid.SetColumn(main_container, grid_column);

            background = new Image()
            {
                Source = new BitmapImage(new Uri(ImagesPath.SearchBackground)),
                Width = 388,
                Height = 60,
                Margin = new Thickness(0),
                Stretch = Stretch.Fill,
                VerticalAlignment = VerticalAlignment.Center
            };

            text_box = new TextBox()
            {
                FontSize = 32,
                FontFamily = new FontFamily("Segoe UI"),
                Height = 50,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                Width = 290,
                BorderThickness = new Thickness(0),
                Background = new SolidColorBrush(new Color() { R = 255, G = 252, B = 250, A = 255 }),
                Margin = new Thickness(29, 6, 0, 0)
            };

            button = new Button()
            {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center,
                Width = 41,
                Height = 41,
                Content = new Image()
                {
                    Source = new BitmapImage(new Uri(ImagesPath.Lens)),
                    Stretch = Stretch.Fill
                },
                Margin = new Thickness(336, 0, 0, 0)
            };

            button.SetResourceReference(Button.StyleProperty, "NoChromeButton");

            Grid.SetRow(background, 0);
            Grid.SetColumn(background, 0);

            Grid.SetRow(text_box, 0);
            Grid.SetColumn(text_box, 0);

            Grid.SetRow(button, 0);
            Grid.SetColumn(button, 0);

            main_container.Children.Add(background);
            main_container.Children.Add(text_box);
            main_container.Children.Add(button);
        }

        internal Grid MainContainer
        {
            get { return main_container; }
        }

        internal TextBox TextBox
        {
            get { return text_box; }
        }
    }

    #endregion
}
